<template>
  <div class="login-container">
    <!-- 已登录 -->
    <div class="header" v-if="isShowLogin">
      <div class="login-title">
        <van-icon
          name="setting-o"
          class="myIcon"
          @click="$router.push('/myZiliao')"
        />
        <van-image
          round
          fit="cover"
          class="img"
          src="https://img01.yzcdn.cn/vant/cat.jpeg"
        />
        <div class="login-name">
          <span class="name">大冤种</span>
          <span class="text">水泥封心</span>
        </div>
      </div>
    </div>
    <!-- 未登录 -->
    <div class="header login-header" @click="$router.push('/login')" v-else>
      <div class="login-title">
        <van-image
          round
          fit="cover"
          class="img"
          src="https://img01.yzcdn.cn/vant/cat.jpeg"
        />
        <div class="login-name">
          <span class="name">请登录</span>
          <span class="text">登录之后查看更多</span>
        </div>
      </div>
      <div><van-icon name="arrow" class="login-icon" /></div>
    </div>
    <!-- 宫格 -->
    <van-grid clickable :column-num="3" v-if="isShowLogin">
      <van-grid-item icon="like-o" text="收藏1篇" to="/myCang" />
      <van-grid-item icon="good-job-o" text="点赞20篇" to="/myZan" />
      <van-grid-item icon="newspaper-o" text="发布1篇" to="/myText" />
    </van-grid>
    <!-- 宫格 -->
    <van-cell icon="send-gift-o" title="我的文章" is-link to="/myText" />
    <van-cell icon="like-o" title="我的收藏" is-link to="/myCang" />
    <van-cell icon="good-job-o" title="我的点赞" is-link to="/myZan" />
    <!-- 退出按钮 -->
    <div style="margin: 16px">
      <van-button
        block
        type="info"
        native-type="button"
        v-if="isShowLogin"
        @click="selFn"
        >立即退出</van-button
      >
    </div>
  </div>
</template>

<script>
export default {
  name: "MyIndex",
  components: {},
  props: {},
  data() {
    return {
      isShowLogin: true,
    };
  },
  computed: {},
  watch: {},
  created() {},
  mounted() {},
  methods: {
    selFn() {
      this.isShowLogin = false;
    },
  },
};
</script>
<style lang="less" scoped>
.login-container {
  .header {
    height: 246px;
    background-color: #1989fa;
    padding-left: 40px;
  }
  .login-title {
    display: flex;
    align-items: center;
    .img {
      width: 200px;
      height: 200px;
      border: 6px solid #fff;
    }
    .login-name {
      display: flex;
      flex-direction: column;
      justify-content: center;
      padding-left: 40px;
      color: #fff;
      .name {
        font-size: 40px;
      }
      .text {
        font-size: 12px;
      }
    }
    .myIcon {
      position: fixed;
      right: 26px;
      top: 26px;
      z-index: 999;
      font-size: 40px;
      color: #fff;
    }
  }
  .login-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-right: 28px;
    .login-icon {
      color: #fff;
      font-size: 60px;
    }
  }
}
</style>
